home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / etc / init.d / brltty < prev    next >
Text File  |  2009-10-13  |  2KB  |  83 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          brltty
  4. # Required-Start:    mountkernfs
  5. # Required-Stop:     
  6. # Should-Start:      udev
  7. # Should-Stop:
  8. # Default-Start:     S
  9. # Default-Stop:
  10. # Short-Description: Braille terminal driver 
  11. # Description: Used to provide access to refreshable braille terminals.
  12. ### END INIT INFO
  13.  
  14. set -e
  15.  
  16. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  17. DAEMON=/sbin/brltty
  18. NAME=brltty
  19. DESC='Braille terminal driver'
  20. BRLTTY_CONF_PKG_MD5SUM=9665c0407135af765da2e4977c41d654
  21. BRLTTY_CONF_MD5SUM=$(md5sum /etc/brltty.conf)
  22.  
  23. test -f $DAEMON || exit 0
  24.  
  25. # /etc/brltty.conf may need to be propagated from the initramfs. (This is a
  26. # pretty awful hack.)
  27. if [ -e /dev/.initramfs/brltty.conf ] && [ -e /etc/default/brltty ]; then
  28.     if [ -e /etc/brltty.conf ] && [ "$BRLTTY_CONF_MD5SUM" = "$BRLTTY_CONF_PKG_MD5SUM" ]; then
  29.         mv /etc/brltty.conf /etc/brltty.conf.orig
  30.         mv /dev/.initramfs/brltty.conf /etc/brltty.conf
  31.     fi
  32.     sed -i -e 's/^RUN_BRLTTY=.*/RUN_BRLTTY=yes/' /etc/default/brltty
  33. fi
  34.  
  35. [ ! -f /etc/default/brltty ] || . /etc/default/brltty
  36.  
  37. # Edit /etc/default/brltty and set RUN_BRLTTY=yes to allow brltty to be
  38. # started.
  39. if [ "$RUN_BRLTTY" != yes ]; then
  40.     exit 0
  41. fi
  42.  
  43. set -e
  44.  
  45. . /lib/lsb/init-functions
  46.  
  47. case "$1" in
  48.   start)
  49.     log_daemon_msg "Starting $DESC" "$NAME"
  50.     if start-stop-daemon --start --oknodo --exec $DAEMON -- -q; then
  51.         log_end_msg 0
  52.     else
  53.         log_end_msg 1
  54.     fi
  55.     ;;
  56.   stop)
  57.     log_daemon_msg "Stopping $DESC" "$NAME"
  58.     if start-stop-daemon --stop --quiet --oknodo --retry 5 --exec $DAEMON; then
  59.         log_end_msg 0
  60.     else
  61.         log_end_msg 1
  62.     fi
  63.     ;;
  64.   restart|force-reload)
  65.     log_daemon_msg "Restarting $DESC" "$NAME"
  66.     start-stop-daemon --stop --quiet --retry 5 --exec $DAEMON
  67.     if start-stop-daemon --start --quiet --exec $DAEMON -- -q; then
  68.         log_end_msg 0
  69.     else
  70.         log_end_msg 1
  71.     fi
  72.     ;;
  73.   status)
  74.         status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
  75.         ;;
  76.   *)
  77.     echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" >&2
  78.     exit 1
  79.     ;;
  80. esac
  81.  
  82. exit 0
  83.